package com.example.demo3;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RequestMapping("/param")
@RestController
public class ParamController {
    @RequestMapping("/m1")
    public String m1(String name){
        return "姓名:"+name;
    }
    @RequestMapping("/m2")
    public String m2(String name,Integer age){
        return "姓名: "+name+" age: "+age;
    }
    @RequestMapping("/m3")
    public String m3(Person person){
        return person.toString();
    }
    @RequestMapping("/m4")
    public String m4(@RequestParam(value = "name",required = false) String n){
        return n;
    }
    @RequestMapping("/m5")
    public String m5(String[] str){
        return Arrays.toString(str);
    }
    @RequestMapping("/m6")
    public String m6(@RequestParam List<String> str){
    return "结果:"+str;
    }
}
